#include"Sort.h"

void test1()
{
	int arr[] = { 3,2,1,2,5,6,2,7,9,0 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	PrintArray(arr, sz);
	//SelectSort(arr, sz);
	//BubbleSort(arr, sz);
	//InsertSort(arr, sz);
	//ShellSort(arr, sz);
	//HeapSort(arr, sz);
	PrintArray(arr, sz);
}
void test1OP()
{
	int N = 10000;
	int i = 0;
	int* a1 = (int*)malloc(sizeof(int) * N);
	int* a2 = (int*)malloc(sizeof(int) * N);
	int* a3 = (int*)malloc(sizeof(int) * N);
	int* a4 = (int*)malloc(sizeof(int) * N);
	int* a5 = (int*)malloc(sizeof(int) * N);
	for (i = 0; i < N; i++)
	{
		a1[i] = rand();
		a2[i] = a1[i];
		a3[i] = a1[i];
		a4[i] = a1[i];
		a5[i] = a1[i];
	}
	//SelectSort(arr, sz);
	//BubbleSort(arr, sz);
	//InsertSort(arr, sz);
	//ShellSort(arr, sz);
	//HeapSort(arr, sz);
	int begin1 = clock();
	HeapSort(a5, N);
	int end1 = clock();
	printf("HeapSort:%d\n", end1 - begin1);

	begin1 = clock();
	ShellSort(a4, N);
	end1 = clock();
	printf("ShellSort:%d\n", end1 - begin1);

	begin1 = clock();
	InsertSort(a3, N);
	end1 = clock();
	printf("InsertSort:%d\n", end1 - begin1);

	begin1 = clock();
	SelectSort(a1, N);
	end1 = clock();
	printf("SelectSort:%d\n", end1 - begin1);
	
	begin1 = clock();
	BubbleSort(a2, N);
	end1 = clock();
	printf("BubbleSort:%d\n", end1 - begin1);
	/*for (int i = 0; i < N; i++)
	{
		printf("%d ", a1[i]);
	}*/
	free(a1);
	free(a2);
	free(a3);
	free(a4);
	free(a5);
}
int main()
{
	srand((unsigned)time(NULL));
	//test1();
	test1OP();
	return 0;
}

